Skip to content

Added format attribute to @Parameter #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

BoudewijnvanLangerak
Copy link

Added format attribute to @parameter for formating the value in the SwingNumberWidget

Intended to fix:
scijava/scijava-ui-swing#45

Copy link
Member

@imagejan imagejan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @BoudewijnvanLangerak for working on this. Unfortunately, your PR includes significant changes to the public API, and I doubt it will find its way into SciJava any time soon. @ctrueden might want to include something like this into his work on SJC3?

In the past, Curtis suggested to use and extend the style attribute for similar functionality (e.g. like style="files,extensions:tiff" for File[] parameters).

We could for example do something like this:

#@ Double (style="slider,format:0.000000")

@@ -205,4 +205,6 @@
/** Sets the item's current value with respect to the given module. */
void setValue(Module module, T value);

/** Gets the item's format*/
String getFormat();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new API will break all implementations of ModuleItem (except those extending AbstractModuleItem, of course). It requires increasing the major version of scijava-common to 3.x.x..

* Test commands for verifying that invalid module parameters are dealt with
* using proper error handling.
*
* @author Curtis Rueden
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ctrueden isn't the author of this class, right? I suppose this was just copy-pasted from the other test class?

@imagejan
Copy link
Member

I'm closing this is now in favor of a backwards-compatible solution using the style parameter attribute, as implemented in scijava/scijava-ui-swing#54.

@imagejan imagejan closed this Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants